#!/usr/local/bin/perl -w
use strict;
use utf8;
use lib '../lib';

use Data::Dumper;
$Data::Dumper::Deparse = 1;

use NG::Sys::App 'NG::Sys::Loop::Cron';

my $app = new NG::Sys::App;

$app->run;

sub on_process {
	my ($self,$test) = @_;
	print "is ",($self == $app?"yes":"no"),"\n";
	print "test='",$test,"'\n";
	return 0;
}
sub on_init_process {
	my $self = shift;
	return ($self->arg->{test}||"",$self->arg->{demo}||"");
}
sub on_before_process {
	my ($self,@args) = @_;
	local $" = "', '";
	print "in before '@args'\n";
	return $args[1];
}
sub on_after_process {
	my ($self,@args) = @_;
	local $" = "', '";
	print "in after '@args'\n";
}
sub on_done_process {
	my $self = shift;
	if($self->arg->{sleep} && $self->arg->{sleep} > 0){
		print "i'm sleeping ",$self->arg->{sleep},"\n";
		sleep $self->arg->{sleep};
		print "wakeup\n";
	}
}